/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package gui.benhan;

import com.toedter.calendar.JDateChooser;
import control.benhan.BAMainPanel_Ctrl;
import control.benhan.BASuaThongTin_Dialog_Ctrl;
import gui.event.benhan.BASuaThongTinDlg_evt;
import javax.swing.ButtonGroup;
import javax.swing.JRadioButton;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.JTable;
/**
 *
 * @author Admin
 */
public class BASuaThongTin_Dialog extends javax.swing.JDialog {
        private ButtonGroup bgTrangThai;
	private JTable table;

    /**
     * Creates new form BASuaThongTin_Dialog
     */
    public BASuaThongTin_Dialog(JTable table, java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        this.table = table;
        bgTrangThai = new ButtonGroup();
        bgTrangThai.add(rbtnConBenh);
        bgTrangThai.add(rbtnHetBenh);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        lbMaHoSo = new javax.swing.JLabel();
        txtMaHoSo = new javax.swing.JTextField();
        lbMaBenh = new javax.swing.JLabel();
        txtMaBenh = new javax.swing.JTextField();
        jLabelNgayBatDau = new javax.swing.JLabel();
        lbNgayKetThuc = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        rbtnConBenh = new javax.swing.JRadioButton();
        rbtnHetBenh = new javax.swing.JRadioButton();
        lbGhiChu = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        taGhiChu = new javax.swing.JTextArea();
        btnLuu = new javax.swing.JButton();
        btnClose = new javax.swing.JButton();
        jDateChooserNgayBatDau = new com.toedter.calendar.JDateChooser();
        jDateChooserNgayKetThuc = new com.toedter.calendar.JDateChooser();
        txtMaVatNuoi = new javax.swing.JTextField();
        lbMaVatNuoi = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Sửa Thông Tin Bệnh Án");

        lbMaHoSo.setText("Mã hồ sơ");

        txtMaHoSo.setEnabled(false);

        lbMaBenh.setText("Mã bệnh");

        jLabelNgayBatDau.setText("Ngày bắt đầu");

        lbNgayKetThuc.setText("Ngày kết thúc");

        jLabel2.setText("Trạng thái");

        rbtnConBenh.setSelected(true);
        rbtnConBenh.setText("Còn bệnh");
        rbtnConBenh.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rbtnConBenhActionPerformed(evt);
            }
        });

        rbtnHetBenh.setText("Hết bệnh");

        lbGhiChu.setText("Ghi chú");

        taGhiChu.setColumns(20);
        taGhiChu.setRows(5);
        jScrollPane1.setViewportView(taGhiChu);

        btnLuu.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gui/images/ultility/Save-16.png"))); // NOI18N
        btnLuu.setText("Lưu");
        btnLuu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnLuuActionPerformed(evt);
            }
        });

        btnClose.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gui/images/ultility/Close-16.png"))); // NOI18N
        btnClose.setText("Đóng");
        btnClose.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCloseActionPerformed(evt);
            }
        });

        lbMaVatNuoi.setText("Mã vật nuôi");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(btnLuu, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnClose, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(lbMaHoSo)
                            .addComponent(lbNgayKetThuc, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addComponent(lbMaVatNuoi, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jLabelNgayBatDau, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(lbMaBenh, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addComponent(lbGhiChu, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(rbtnConBenh)
                                .addGap(18, 18, 18)
                                .addComponent(rbtnHetBenh))
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 247, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jDateChooserNgayBatDau, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jDateChooserNgayKetThuc, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addComponent(txtMaBenh, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 205, Short.MAX_VALUE)
                                .addComponent(txtMaHoSo, javax.swing.GroupLayout.Alignment.LEADING))
                            .addComponent(txtMaVatNuoi, javax.swing.GroupLayout.PREFERRED_SIZE, 205, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(0, 8, Short.MAX_VALUE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(17, 17, 17)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lbMaHoSo)
                    .addComponent(txtMaHoSo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(txtMaVatNuoi, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(lbMaVatNuoi, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGap(2, 2, 2)))
                .addGap(9, 9, 9)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(txtMaBenh)
                    .addComponent(lbMaBenh, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabelNgayBatDau)
                    .addComponent(jDateChooserNgayBatDau, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lbNgayKetThuc)
                    .addComponent(jDateChooserNgayKetThuc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(rbtnConBenh)
                    .addComponent(rbtnHetBenh))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lbGhiChu))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 29, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnLuu)
                    .addComponent(btnClose))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnLuuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLuuActionPerformed
//        System.out.println("run,....");
        rbtnConBenh.setActionCommand("Còn bệnh");
        rbtnHetBenh.setActionCommand("Hết bệnh");
        BASuaThongTinDlg_evt.btnLuuActionPerformed();
        BASuaThongTin_Dialog_Ctrl.suaThongTinBA(table, txtMaHoSo, txtMaVatNuoi, txtMaBenh, jDateChooserNgayBatDau, jDateChooserNgayKetThuc, bgTrangThai, taGhiChu);
        BASuaThongTinDlg_evt.btnCloseActionPerformed(this);
    }//GEN-LAST:event_btnLuuActionPerformed

    private void btnCloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCloseActionPerformed
        BASuaThongTinDlg_evt.btnCloseActionPerformed(this);
    }//GEN-LAST:event_btnCloseActionPerformed

    private void rbtnConBenhActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rbtnConBenhActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_rbtnConBenhActionPerformed

    /**
     * @param args the command line arguments
     */
    //    public static void main(String args[]) {
//        /* Set the Nimbus look and feel */
//        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
//        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
//         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
//         */
//        try {
//            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
//                if ("Nimbus".equals(info.getName())) {
//                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
//                    break;
//                }
//            }
//        } catch (ClassNotFoundException ex) {
//            java.util.logging.Logger.getLogger(BASuaThongTin_Dialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (InstantiationException ex) {
//            java.util.logging.Logger.getLogger(BASuaThongTin_Dialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (IllegalAccessException ex) {
//            java.util.logging.Logger.getLogger(BASuaThongTin_Dialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
//            java.util.logging.Logger.getLogger(BASuaThongTin_Dialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        }
//        //</editor-fold>
//
//        /* Create and display the dialog */
//        java.awt.EventQueue.invokeLater(new Runnable() {
//            public void run() {
//                BASuaThongTin_Dialog dialog = new BASuaThongTin_Dialog(new javax.swing.JFrame(), true);
//                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
//                    @Override
//                    public void windowClosing(java.awt.event.WindowEvent e) {
//                        System.exit(0);
//                    }
//                });
//                dialog.setVisible(true);
//            }
//        });
//    }
    

    public JTextArea getTaGhiChu() {
        return taGhiChu;
    }

    public JTextField getTxtMaHoSo() {
        return txtMaHoSo;
    }

    public JTextField getTxtMaBenh() {
        return txtMaBenh;
    }

    public ButtonGroup getBgTrangThai() {
        return bgTrangThai;
    }

    public JTable getTable() {
        return table;
    }

    public JDateChooser getjDateChooserNgayBatDau() {
        return jDateChooserNgayBatDau;
    }

    public JDateChooser getjDateChooserNgayKetThuc() {
        return jDateChooserNgayKetThuc;
    }

    public JRadioButton getRbtnConBenh() {
        return rbtnConBenh;
    }

    public JRadioButton getRbtnHetBenh() {
        return rbtnHetBenh;
    }

    public JTextField getTxtMaVatNuoi() {
        return txtMaVatNuoi;
    }
    

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnClose;
    private javax.swing.JButton btnLuu;
    private com.toedter.calendar.JDateChooser jDateChooserNgayBatDau;
    private com.toedter.calendar.JDateChooser jDateChooserNgayKetThuc;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabelNgayBatDau;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JLabel lbGhiChu;
    private javax.swing.JLabel lbMaBenh;
    private javax.swing.JLabel lbMaHoSo;
    private javax.swing.JLabel lbMaVatNuoi;
    private javax.swing.JLabel lbNgayKetThuc;
    private javax.swing.JRadioButton rbtnConBenh;
    private javax.swing.JRadioButton rbtnHetBenh;
    private javax.swing.JTextArea taGhiChu;
    private javax.swing.JTextField txtMaBenh;
    private javax.swing.JTextField txtMaHoSo;
    private javax.swing.JTextField txtMaVatNuoi;
    // End of variables declaration//GEN-END:variables
}
